package com.mindmax.wordmemory.service.impl;

import java.util.List;

import com.mindmax.wordmemory.domain.DataVocabulary;
import com.mindmax.wordmemory.mapper.DataVocabularyMapper;
import com.mindmax.wordmemory.service.IDataVocabularyService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 正式词库Service业务层处理
 * 
 * @author cab
 * @date 2024-04-24
 */
@Service
public class DataVocabularyServiceImpl implements IDataVocabularyService
{
    @Autowired
    private DataVocabularyMapper dataVocabularyMapper;

    /**
     * 查询正式词库
     * 
     * @param id 正式词库主键
     * @return 正式词库
     */
    @Override
    public DataVocabulary selectDataVocabularyById(Long id)
    {
        return dataVocabularyMapper.selectDataVocabularyById(id);
    }

    /**
     * 查询正式词库列表
     * 
     * @param dataVocabulary 正式词库
     * @return 正式词库
     */
    @Override
    public List<DataVocabulary> selectDataVocabularyList(DataVocabulary dataVocabulary)
    {
        return dataVocabularyMapper.selectDataVocabularyList(dataVocabulary);
    }

    /**
     * 新增正式词库
     * 
     * @param dataVocabulary 正式词库
     * @return 结果
     */
    @Override
    public int insertDataVocabulary(DataVocabulary dataVocabulary)
    {
        dataVocabulary.setCreateTime(DateUtils.getNowDate());
        return dataVocabularyMapper.insertDataVocabulary(dataVocabulary);
    }

    /**
     * 修改正式词库
     * 
     * @param dataVocabulary 正式词库
     * @return 结果
     */
    @Override
    public int updateDataVocabulary(DataVocabulary dataVocabulary)
    {
        dataVocabulary.setUpdateTime(DateUtils.getNowDate());
        return dataVocabularyMapper.updateDataVocabulary(dataVocabulary);
    }

    /**
     * 批量删除正式词库
     * 
     * @param ids 需要删除的正式词库主键
     * @return 结果
     */
    @Override
    public int deleteDataVocabularyByIds(Long[] ids)
    {
        return dataVocabularyMapper.deleteDataVocabularyByIds(ids);
    }

    /**
     * 删除正式词库信息
     * 
     * @param id 正式词库主键
     * @return 结果
     */
    @Override
    public int deleteDataVocabularyById(Long id)
    {
        return dataVocabularyMapper.deleteDataVocabularyById(id);
    }
}
